
<html ng-app="app">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link href="../../build/common/base.css" rel="stylesheet">
	<script type="text/javascript" src="../../build/common/base.js"></script>
	<script type="text/javascript" src="../../build/common/ngEdit.js"></script>

	<script type="text/javascript">
        var app = angular.module('app', ['baseDirective']);
        app.controller("newDefinition", [ '$scope', 'baseService', function($scope, baseService){
            $scope.def = {};
            $scope.def.typeId = window.parent.$("[ab-grid]").bootstrapTable("getOptions").queryParams({})["type_id_$VEQ"] || "";

            $scope.save = function(){
                if (!$scope.myForm.$valid) return;
                var defer = baseService.post(__ctx+"/bpm/definition/save", $scope.def);
                $.getResultData(defer,function(data){
                    $.Toast.success("添加成功!");
                    parent.reloadGrid();
                    var tab = {name:"设计流程图",url:"/flow-editor/modeler.html?modelId="+data,id:"设计流程图"};
                    //	$.Tab(tab,true);
                    var conf = {title:"设计流程图",topOpen:true,url:"/flow-editor/modeler.html?modelId="+data};
                    $.Dialog.open(conf);
                    $.Dialog.close(window);
                });
            }
        }]);

	</script>
</head>
<body ng-controller="newDefinition">
<div class="ibox-title" style="margin-top: -5px;">
	<a class="btn btn-primary fa-save"  href="javascript:void(0)" id="aaa" ng-click="save()">创建</a>
	<a href="javascript:void(0)" class="btn btn-primary fa-reply" onclick="javascript:$.Dialog.close(window);">取消</a>
</div>
<form name="myForm">
	<table class="form-table">
		<tr>
			<th>流程分类</th>
			<td><span style="display: block;max-width:360px" ab-combox="def.typeId" tree-key="flow" ng-model="def.typeId" ab-validate="{required:true,maxlength:64}"> </span>
		</tr>
		<tr>
			<th>流程名称</th>
			<td><input ng-model="def.name" ab-validate="{required:true,maxlength:64}" class="form-control"/></td>
		</tr>
		<tr>
			<th>流程KEY</th>
			<td><input ng-model="def.key" ab-pinyin="def.name" ab-validate="{required:true,varirule:true,maxlength:64}" class="form-control"/></td>
		</tr>
		<tr>
			<th>描述</th>
			<td><input ng-model="def.desc" ab-validate="{required:true,maxlength:264}" class="form-control"/></td>
		</tr>
	</table>
	<br/>
	<p class="text-muted">　如果您是第一次使用 AgileBPM 实施流程，建议参考 在线文档 “敏捷流程实施三步曲”</p>
</form>
</body>
</html>